<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>活动详情</title>
    <link rel="stylesheet" href="/layui/css/layui.css">
    <style>
        img{
            width: 100%;
        }
        .createtime {
            font-size: 20px;
            color: #666666;
        }
        #wantorder{
            position: fixed;
            bottom: 0;
            width: 100%;
            height: 50px;
            background-color: red;
            font-size: 25px;
            color: #fff;
            border: red solid 1px;
        }
        .layui-fluid{
            width: 100% !important;
            padding: 0;
        }
        .layui-card-body{
            margin-top: 30px;
        }
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-header">
            <h2 class="title" th:text="${title}"></h2>
            <p class="createtime" th:text="${createtime}"></p>
        </div>
        <div class="layui-card-body">
            <div class="content" id="context">
            </div>
        </div>
    </div>
    <div class="layui-footer">
        <div class="layui-input-inline">
            <a class="layui-btn" id="wantorder">我要预约</a>
        </div>
    </div>

</div>


</body>
<script src="/jquery/jquery.min.js"></script>
<script th:inline="javascript">

    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return unescape(r[2]);
        return null;
    }

    let context = [[${context}]]
    let type = [[${type}]]
    $('#context').append(context);

    let inviteCode = GetQueryString("invite_code");
    if(inviteCode != null){
        $('#wantorder').removeClass('layui-hide');
        if(type == 1){
            $("#wantorder").attr('href','/invite/agent?inviteCode='+inviteCode);
        } else if(type == 2){
            $("#wantorder").attr('href', '/invite/order?inviteCode=' + inviteCode);
        }else{
            $('#wantorder').addClass('layui-hide');
        }
    }else{
        $('#wantorder').addClass('layui-hide');
    }
</script>
</html>